feat: add log frequency visualization per container#2
Open
zhuge-liang-bot[bot] wants to merge 9 commits into
Open
feat: add log frequency visualization per container#2zhuge-liang-bot[bot] wants to merge 9 commits into
zhuge-liang-bot[bot] wants to merge 9 commits into
Conversation
Add a "Logs" column to the container dashboard table showing real-time log output frequency as color-coded stacked bar charts per container. Colors: info=green, warn=orange, error=red, debug=blue, fatal=red. Backend: ContainerStore collects log stats every 5s by sampling recent Docker logs and counting by level using existing level_guesser. Data flows through SubscribeLogStats → SSE "container-log-stat" events. Frontend: New LogFrequencyChart component renders stacked bars. Container model tracks 60-entry log stats history with updateLogStat(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Non-TTY containers return logs with 8-byte binary headers (stream type + length). bufio.Scanner was splitting on newlines within these binary frames, corrupting every line. Now properly strips multiplexed headers before scanning. Also counts lines with unrecognized log levels as "info" instead of silently discarding them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Track restart count (10min window) and exit codes from container events - Show status badges: OOM, SIGTERM, Exit N, crash-loop count, unhealthy - Add anomaly score based on restarts, health, error rate, CPU/mem pressure - Add sortable "Hot" column to surface containers needing attention Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ocking subscribers - Increase bufio.Scanner buffer to 256KB for long JSON log lines - Check scanner.Err() after scan loop to surface truncated reads - Use pw.CloseWithError(err) to propagate demux errors to scanner - Make subscriber send non-blocking (drop stat if slow consumer) - Fix exit 137 label: "Killed" not "OOM" (SIGKILL != guaranteed OOM) - Prune _restartTimestamps on every restartCount access, compute once per getter chain Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract collectLogStatForContainer for cleaner lifecycle management - Use pw.CloseWithError(err) consistently (nil propagation is safe) - Add atomic.Bool guard to prevent overlapping collectLogStats runs - Buffer logStats SSE channel (50) to reduce backpressure on slow clients Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v-memo="[container.id, statMode]" was freezing log sparklines, crash badges, hot scores, and stat displays after initial render. Now tracks state, stat, anomalyScore, and latest logStat so rows re-render when data changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: adding container.stat (object, changes ~1/sec) to v-memo triggered ~13 full row re-renders/sec, cascading into LogFrequencyChart re-mounts (300 DOM elements × 13 containers). Changes: - v-memo now uses only primitives: id, statMode, state, logStatsVersion, anomalyScore (numbers that change every ~5s, not every ~1s) - Container.ts: added logStatsVersion counter + restartCount 1s cache - Go: parallelized collectLogStats with bounded 5-goroutine pool Co-Authored-By: Zhuge <zhugehyuk@gmail.com>
- _logStatsVersion: use property assignment instead of postfix++ on cast expression, which is a no-op when Vue reactive() unwraps the ref - _logStatsVersion: change from readonly to private readonly - collectLogStats: use select with s.ctx.Done() when acquiring semaphore to avoid blocking the loop on context cancellation Co-Authored-By: Zhuge <zhugehyuk@gmail.com>
Add allowed_bots: '*' to claude-code-action step to prevent rejection of PRs opened by zhuge-liang-bot. Co-Authored-By: Zhuge <zhugehyuk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Backend (Go)
container_store.go:collectLogStats()parallelized with semaphore,demuxDockerStream(),atomic.Boolguardevents.go: SSEcontainer-log-statevent emission, buffered channel (50)SubscribeLogStatsthrough DockerClientService → MultiHostService → SSEFrontend (TypeScript/Vue)
LogFrequencyChart.vue: New stacked bar chart component with responsive downsamplingContainer.ts:logStatsVersioncounter,restartCount1s cache,anomalyScore,statusBadgeContainerTable.vue: v-memo with primitives only, Logs/Hot columnscontainer.ts(store): SSE handlers forcontainer-log-statand enhancedcontainer-eventCI
claude-code-review.yml: Addallowed_bots: '*'for bot-initiated PRsCommits (9)
b8e5e97bfeat: add log frequency visualization per container13a2e965fix: demux Docker multiplexed stream in collectLogStats35959b95feat: add crash-loop badges and hot sort column9196594bfix: address Codex review — scanner buffer, error propagation, non-blocking subscribersb3fe9dd0fix: prevent goroutine leak and overlapping log stat collection4562ca93fix: include reactive deps in v-memo to enable live UI updates13b69021fix: resolve v-memo performance regressionbc456b80fix: reactive proxy increment no-op and semaphore context leak74ba36aaci: allow bot actors in claude-code-review workflowTest plan
container-log-statevents emit non-zero data (verified on dev2)🤖 Generated with Claude Code